﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace AssessmentTool.PresentationLogic
{
    public class Session
    {
        public static Session _instance;

        private Dictionary<string, object> values;
        private Dictionary<string, string> languageDictionary;
        public static Session getInstance()
        {
            if (_instance == null)
                _instance = new Session();
            return _instance;

        }
        private Session()
        {
            values = new Dictionary<string, object>();
        }
        public object getValue(String key)
        {
            return values[key];
        }

        public void addValue(String key, object value)
        {
            if (values.ContainsKey(key))
                updateValue(key, value);
            else
                values.Add(key, value);
        }
        public void updateValue(String key, object value)
        {
            values[key] = value;
        }
        public void removeValue(String key)
        {
            if (values.ContainsKey(key))
                values.Remove(key);
        }

        public void setLanguageDictionary(Dictionary<string, string> dictionary)
        {
            this.languageDictionary = dictionary;
        }
        public string getLanguageDictionaryString(String code)
        {
            return languageDictionary[code];
        }
    }
}
